Baud rate detection in serial data transmission

ABSTRACT

A method for automatically determining the baud rate of a serial data transmission comprises the steps of setting a receiving device to a first baud rate, processing ( 65 ) a first data word received by said receiving device and possibly further information to determine said baud rate of said data transmission, possibly setting ( 68 ) said receiving device to a second baud rate in order to enable said receiving device to find the beginning of a subsequent data word in said serial data transmission, and possibly setting ( 74 ) said receiving device to said determined baud rate. A corresponding apparatus and a mobile telephone each employs this method. The invention provides an autobauding function which causes little expense in terms of hardware and processing time, and which will correctly synchronize with the serial data transmission even if the transmitted data words immediately follow each other.

The invention concerns a method and an apparatus for determining thebaud rate of a serial data transmission as well as a mobile telephone.The invention may be used for all kinds of applications in which aserial data transmission is established or maintained. In particular,the invention may be used in a compact low-power device such as a mobiletelephone in which a single microcontroller executes a plurality oftasks in a time sharing manner.

Modern mobile telephones, especially those according to the GSM standard(GSM=global system for mobile communications), offer a variety ofcommunication services, in particular voice, data and fax services. Forthe transmission of data and faxes the mobile telephone is connected toa computer (usually a laptop computer), and receives the information tobe transmitted therefrom. Known mobile telephones comprise a proprietaryinterface, which communicates with a special data transmission cardinserted in the computer. This approach is quite expensive and requiresspecial hardware, which occupies one card slot of the computer.

It would be more economical and much more practical for the user if heor she could connect the mobile telephone directly to the standardserial port of the computer using a standard communication and/or faxprogram. A problem with this approach arises from the fact that thecomputer may communicate in a variety of different data transmissionspeeds. It would be very annoying for the user if he or she had toconfigure the mobile telephone manually whenever a serial transmissionis established or the transmission speed is changed. The mobiletelephone should therefore be able to determine the transmission speedor baud rate (number of transmission steps per second) automatically.

U.S. Pat. No. 5,367,541 (corresponding to EP 0 544 965 A1) discloses amethod for setting the asynchronous transmission characteristics of atelecommunication equipment operating at different transmission rates. Afirst character is received using predetermined transmission parameters,the actual transmission speed is determined on the basis of the receivedcharacter, and the telecommunication equipment is set to thistransmission speed. Then the occurrence of a second character isawaited. Preferably, processing of the second character does not beginbefore a period of 100 ms has elapsed. This method assumes that a usertypes a predetermined sequence of characters on a keyboard. It onlyworks if there is a rather long interval between the first twocharacters, said interval allowing the telecommunication equipment tofind the beginning of the second character.

U.S. Pat. No. 5,008,902 discloses a method to determine the baud rate ofa data stream by comparison of captured data to known autobaudcharacters. The data stream is first sampled at a faster data rate thanthe highest possible baud rate. The sampled data is compared to knowndata. If a match occurs, the matched baud rate is determined andselected. Such a match also signals that the sample clock is correctlysynchronized with the incoming data stream, such that no furthersynchronization measures need to be taken. This method requires specialsampling hardware, which causes additional costs and is normally notavailable in mobile telephones.

It is therefore the object of the invention to provide an autobaudingfunction which avoids the above-mentioned problems, which causes aminimum of expense in terms of hardware and processing time, and whichwill correctly synchronize with the serial data transmission even if thetransmitted data words immediately follow each other.

According to the invention, this object is attained by a method forautomatically determining the baud rate of a serial data transmissionhaving the features of claim 1, a corresponding apparatus having thefeatures of claim 9 and a mobile telephone including such an apparatus.Preferred embodiments of the invention are recited in the dependentclaims.

The invention is based on the idea to set a receiving device to a first(possibly incorrect) baud rate, and to determine the correct baud rateof the data transmission on the basis of the received data word andpossibly further information. If the first baud rate has not been thecorrect one, the receiving device is set to a second baud rate, which ischosen in a way that the beginning of a subsequent data word in theserial data transmission can be detected correctly by the receivingdevice.

Employing the teachings of the invention, the processor does only needto program or reprogram the receiving device in a suitable way, whichcan be done very quickly. Thus the autobauding procedure only causes avery small processor load. In particular, it does not require theattention of the processor for an extended or continuous period of time.This enables the processor to execute other tasks concurrently undercontrol of a time sharing operating system. The actual receiving stepsmay be performed by the receiving device independently from theprocessor. Since a typical microcontroller already contains a receivingdevice, the available hardware is used very well.

According to the invention, the first received data word does not needto correspond to one single baud rate. Other information, for exampleinformation obtained from a direct sampling of at least one bit value ofthe received signal, may additionally be used to determine the correctbaud rate. In preferred embodiments, however, the first received dataword uniquely identifies the baud rate, and the correct baud rate isdetermined solely on the basis of this data word. It is to be noted thatthe first received data word may be different from the first transmitteddata word. For example, if the first baud rate is faster than the actualbaud rate of the data transmission, the first received data word willonly reflect an initial portion of the first transmitted data word.

The invention teaches to perform an intermediate step using the secondbaud rate to enable the receiving device to synchronize with the serialdata transmission. Preferably the beginning of a predeterminedsubsequent data word is detected. In further preferred embodiments, thepredetermined subsequent data word is the second data word in the serialdata transmission, i.e. the next data word after the first one. Thuseven an immediately following second data word can be read in at thecorrect baud rate.

The serial data transmission preferably comprises at least onepredetermined autobauding data word, which may be one of the characters‘A’ or ‘a’, and the next character in the serial data transmission maybe ‘T’ or ‘t’. In preferred embodiments, a sequence of at least one, orat least two, or at least three comparisons is performed to determinethe actual baud rate from the first received data word. A suitablelook-up table may be used in other embodiments. This look-up table mayor may not comprise an entry for the case that the first baud rate hasby chance been the correct one.

In preferred embodiments, the first baud rate corresponds to the maximumbaud rate detectable by the autobauding mechanism. In other embodimentsthe first baud rate may be higher than the maximum baud rate since itmay then be possible to detect further characteristics of the serialdata transmission (e.g., parity) for all admissible baud rates. Theautobauding mechanism is especially reliable if slight timing variationsin the serial data transmission are taken into account.

The second baud rate, to which the receiving device is set, preferablydepends on the determined baud rate of the data transmission and/or onthe autobauding character. In particular, the second baud rate may beset such that the receiving device will have read a full data word bythe time the first actually transmitted data word ends. In preferredembodiments of the invention, the second baud rate may be faster thanthe determined baud rate by a factor of either ranging from 5 to 20(preferably about 10) or ranging from 1.2 to 2 (preferably 1.5). Whichof these ranges is chosen may depend on the determined baud rate.

It is further preferred to echo each received data word. A sendingdevice connected to the processor may serve for this purpose. There maybe a delay in echoing the first data word, which may be derived from thesecond received data word.

The receiving device, which may be a standard UART (universalasynchronous receiver/transmitter), does in preferred embodiments startto sample a signal level of the serial data transmission when apredetermined start condition is met. This start condition may be amark-to-space transition in said serial data transmission.

Several sample embodiments of the invention will now be described inmore detail with reference to the schematic drawings, in which:

FIG. 1 shows a block diagram of a mobile telephone,

FIG. 2 shows a block diagram of a microcontroller in a first sampleembodiment,

FIG. 3 shows a timing diagram of a received data signal at fourdifferent baud rates,

FIG. 4 shows a timing diagram like that of FIG. 3, in which the timescale has been condensed by a factor of four,

FIG. 5 shows a flow diagram of a program routine used to initiate theautobauding function,

FIG. 6A and FIG. 6B together show a flow diagram of an interrupthandling routine,

FIG. 7 shows a block diagram like that of FIG. 2 in a further sampleembodiment.

The mobile telephone 10 shown in FIG. 1 is a hand-held GSM telephoneequipped with a serial interface having an autobauding capability. Theinterface conforms to the RS-232 or V.24 standard, but other serialcommunication methods may be used in alternative embodiments. All kindsof data may be transferred to and from the telephone 10 via theinterface. This includes fax or other data to be sent or received viathe telephone 10, data used to configure the telephone 10, and data readout from the telephone 10 for service or repair purposes.

The mobile telephone 10 as such is well known. It comprises an analogunit 12 for sending and receiving high frequency signals via an antenna14. The analog unit 12 is connected to a speaker 16, a microphone 18 anda digital control unit 20. The control unit 20 in turn comprises anintegrated microcontroller 22, which provides the serial datatransmission capability, and which is connected to a serial dataconnector 24 via a driver circuit 26. The microcontroller 22 may be aSAB 80C166 integrated circuit manufactured by Siemens AG, Germany, orany other suitable device. A plurality of program routines, some ofwhich are time critical, run on the microcontroller 22 in a time sharingfashion for providing the various functions of the telephone 10. Furthercomponents of the telephone 10, like a display, a keypad, and a powersupply unit, are conventional and not shown in FIG. 1.

FIG. 2 depicts some of the internal components of the microcontroller22. A processor 28 is connected to a memory unit 30 via a memory bus 32.The memory unit 30 comprises a read-only program memory and a read/writememory to store temporary data values. A UART 34 (UART=universalasynchronous receiver/transmitter) is connected to the processor 28 overan internal bus 36 and a UART interrupt line 38. The UART 34 comprises asending device 40 to generate a transmit data signal TXD on a line 44and a receiving device 42, to which a line 46 carrying a received datasignal RXD is connected. The lines 44 and 46 and further lines forvarious control signals are coupled to the driver circuit 26 (shown inFIG. 1).

During operation, the UART 34 receives data words to be sent and controlinformation from the processor 28 via the internal bus 36. The datawords are sent by the sending device 40 in a serial fashion over theline 44 to the driver circuit 26, and the control information determinesthe serial transmission characteristics of the UART 34 with respect tosending and receiving (for example, baud rate, number of data and stopbits, and parity). The receiving device 42 of the UART 34 continuouslymonitors the incoming RXD signal on line 46 and converts it into datawords. Whenever a complete data word is received, an interrupt isgenerated for the processor 28 on the UART interrupt line 38.

FIG. 3 and FIG. 4 each show four samples of a received data signal RXDat data transmission speeds of 19200 baud, 9600 baud, 4800 baud and 2400baud, respectively. For the sake of clarity, FIG. 3 is an enlargedrepresentation of the first 20 time intervals shown in FIG. 4. In thisexample, the time intervals indicated on top of FIG. 3 and FIG. 4 have aduration of 52 μs each. The arrows pointing downwards from the timeintervals represent possible sample points at which the receiving device42 of the UART 34, if set to a baud rate of 19200 baud, will sample theincoming signal RXD. In FIG. 3 and FIG. 4, a mark condition of thereceived signal RXD is denoted by a high level, and a space condition isdenoted by a low level. Other representations are possible, depending onthe characteristics of the driver circuit 26 and the UART 34.

Each of the four RXD signals of FIG. 3 and FIG. 4 corresponds to thetransmission of one character ‘A’ or ‘a’. In the ASCII code thesecharacters are represented by data words 0×41 and 0×61, respectively(the prefix 0× denoting a hexadecimal value). As set forth in the RS-232or V.24 standard, each transmission of a data word begins with a startbit, which is characterized by an initial mark-to-space transitionfollowed by a space condition for one bit length. Then the data word istransmitted bit by bit, starting with the least significant bit (firstbit) and ending with the most significant bit (eighth bit). At least oneend bit, which is a mark condition during at least one bit length,concludes the transmission.

Consider, for example, an RXD signal sent at 19200 baud. The start bitis transmitted in time interval 1, followed by the least significant bit(a binary 1) in time interval 2. Subsequently, there are four binary 0bits and two binary 1 bits if the character ‘a’ is transmitted(continuous line in FIG. 3 and FIG. 4), or five binary 0 bits and onebinary 1 bit for the character ‘A’ (dashed line in FIG. 3 and FIG. 4).The most significant data bit (binary 0) is sent in time interval 9, andthe stop bit is sent in time interval 10. The start bit of the nextcharacter may follow immediately after time interval 10. For slowertransmission speeds, the bit length of each individual bit is increasedaccordingly.

FIG. 3 and FIG. 4 show an example of an “8 data bits, no parity”transmission characteristic. In other transmission characteristics, theeighth data bit may be replaced by a so-called parity bit. This paritybit may always be a binary 0 (“space parity”), or always a binary 1(“mark parity”), or it may be chosen such that the total number ofbinary 1 bits in the transmitted data word is even or odd, respectively(“even parity” or “odd parity”).

In the example embodiments described herein, the autobauding procedureexpects to receive either the characters “AT” or “at” as the first twodata words. This command prefix is well-known and standardized by theV.25ter standard. The first character serves as an autobauding characterand is sufficient to determine the correct baud rate and the beginningof the second character. The second character is read correctly. Sincethe autobauding function may be unable to obtain any information aboutthe first character, the second character is used to determine the firstone. In alternative embodiments, another autobauding character or otherautobauding characters may be used.

First an embodiment of the invention will be described in which theautobauding character must be sent either in a “8 data bits, no parity”or in a “7 data bits, space parity” transmission characteristic, asshown in FIG. 3 and FIG. 4.

FIG. 5 shows how the autobauding process is initiated. The processor 28sets the UART 34 to the transmission characteristic of 8 data bits, noparity and a first baud rate (box 50). The first baud rate is 19200 baudin the present sample embodiment. Then the UART interrupt is enabled. Asuitable marker value is stored in the memory unit 30, designating thecurrent stage of the autobauding process (box 52). This marker valuewill be referred to as an “interrupt type” in the following, since itdetermines the functions to be performed upon the occurrence of a UARTinterrupt. In the present case, a type A interrupt is enabled. For thesample embodiments described herein, the actual interrupt signal on line38 is the same for all interrupt types, the distinction being made onlyon the basis of the marker value. In alternative embodiments, theinterrupt types may be distinguished on the hardware level.

The initial stage of the autobauding routine is now finished, and theprocessor 28 is free to perform other tasks necessary for the operationof the mobile telephone 10. The receiving device 42 of the UART 34 willcontinually monitor the RXD signal for the occurrence of a start bit(mark-to-space transition). After completion of the start bit in timeinterval 1 (FIG. 3 and FIG. 4), the UART 34 samples the next 8 data bitsat the predetermined first baud rate of 19600 baud (time intervals 2 to9 in FIG. 3 and FIG. 4). When the stop bit is detected in time interval10, the UART 34 generates an interrupt on line 38.

Upon occurrence of the UART interrupt, the processor 28 performs theinterrupt handling routine shown in FIG. 6A and FIG. 6B. A maximuminterrupt response time of 100 μs is required. The processor 28 firstdetermines the type of the interrupt by looking up the marker valuestored in the memory unit 30. If the maker value designates a type Ainterrupt (test 54), the processor 28 reads the data word received bythe UART 34 (box 56). This data word contains the samples of the RXDsignal taken in time intervals 2 to 9. These samples uniquelycharacterize the baud rate of the data transmission for the range oftransmission speeds considered in this sample embodiment. In alternativeembodiments, a larger range of baud rates may be used, such that thefirst data word only identifies a group of several possible baud rates.In these embodiments, further samples are taken either by the UART 34 orby other suitable means.

If the first baud rate has by chance been the correct one, the data wordread by the receiving device 42 of the UART 34 will be 0×41 or 0×61,corresponding to the characters ‘A’ or ‘a’. This condition is detectedin test 58. If this is the case, execution branches to entry point Eshown in FIG. 6B. Here, the processor 28 first writes the received dataword into an appropriate send register of the sending device 40. Thiscauses the received data word to be echoed on line 44 at the set firstbaud rate (box 60). The received data word is also stored in anappropriate buffer section of the memory unit 30 for further processingduring normal operation of the mobile telephone 10. Next, a type Dinterrupt is enabled (box 62). The occurrence of such an interruptsignals that a further character has been received, which may beprocessed without performing any autobauding steps.

If the first baud rate has not been the correct one, it is neverthelesspossible to determine the correct baud rate from the data word read bythe UART 34. If, for example, the actual transmission speed is 9600baud, the RXD signal assumes a mark state only during the time intervals3 and 4, and a space state otherwise. Considering that the leastsignificant bit is transmitted first, this corresponds to a data word of0×06 (00000110 in binary notation or 01100000 in the order of the actualdata transmission). For the other possible baud rates, the expected datawords sampled by the UART 34 can derived in a similar fashion. Thefollowing table summarizes the relation between the expected data wordsand the baud rate determined therefrom. The role of the second baud ratewill be explained later.

exp. data word determined baud rate second baud rate 0x06 9600 baud100000 baud  0x78 4800 baud 50000 baud  0x80 2400 baud 3000 baud 0x001200 baud 1500 baud

In step 64 shown in FIG. 6A, the processor 28 compares the data wordread from the UART 34 with several given values in order to determinethe correct baud rate. In the present sample embodiment, the givenvalues are exactly the expected data words of the above table. Inalternative embodiments, the admissible baud rates may be such thatslight timing variations may cause several different first data words tobe received for one particular baud rate. All these possible values arethen considered valid representations of the corresponding baud rate.

Test 58 and step 64 together form a step 65 of determining the correctbaud rate on the basis of the first received data word. Step 64 may beimplemented using a series of successive comparisons or a look-up table.If a look-up table is employed, it may also comprise entries for theexpected characters (i.e. ‘A’ and ‘a’ and the present sampleembodiment). The look-up step may then replace test 58.

When the correct transmission baud rate has been determined, it isstored in the memory unit 30 (box 66). At this time (in time interval 10or shortly thereafter) the transmission of the first data word is notyet finished. If the UART 34 was programmed with the determined baudrate immediately, the next mark-to-space transition would be interpretedas the beginning of the start bit of the next transmitted data word,which would cause the second data word to be read incorrectly. Forexample, at a transmission speed of 9600 baud, the UART 34 wouldconsider the space bit in time intervals 17 and 18 as the start bit ofthe second data word and would start sampling data bits too early.

In order to enable the UART 34 to find the beginning of the next (i.e.,second) data word transmission, the autobauding method provides anintermediate step, in which the UART 34 is set to a second baud rate(box 68). The second baud rate corresponds to a sampling speed whichcauses the remainder of the first character (up to its trailing stopbit) to be interpreted by the UART 34 as a full data word. The value ofthe second baud rate depends on the determined transmission baud rate(box 64) and on the expected autobauding character or characters. Forthe sample embodiments described herein, the second baud rate is givenin the above table. It will be described later how these values arederived.

After the UART 34 has been set to the second baud rate, the processor 28enables a type B interrupt (box 70), which means that the next interruptof the UART 34 signals the end of the intermediate step. The interrupthandling of the type A interrupt is now finished. While the processor 28may perform other tasks, the UART 34 will wait for the nextmark-to-space transition of the RXD signal. When the UART 34 detectsthis transition, the remainder of the first transmitted character isread using the second baud rate sampling speed, and an interrupt will beissued as soon as the stop bit is reached.

This interrupt is classified as a type B interrupt by the interrupthandling routine (test 54 branch “NO” and test 72 branch “YES”). TheUART 34 is now programmed by the processor 28 to use the correct baudrate (box 74), which has been determined and stored during the handlingof the previous type A interrupt (boxes 64 and 66). For example, in thecase of a 9600 baud transmission, the type B interrupt will occur duringtime interval 18 or 19, leaving enough time for the processor 28 torespond to the interrupt and reprogram the UART 34 before thetransmission of the next character starts in time interval 21.

The processor 28 now enables a type C interrupt (box 76) by writing asuitable marker value in the memory unit 30. Then the processor 28resumes its normal mode of operation while the UART 34 receives thesecond character at the correct baud rate.

The occurrence of a type C interrupt signifies that the second characterhas been received by the UART, while the first character has not yetbeen echoed. This interrupt type is detected via test 54 (branch “NO”),test 72 (branch “NO”) and test 78 (branch “YES”). The processor 28 firstreads the second data word from the UART 34 (box 80). In the presentlydescribed sample embodiment, this data word may either be a ‘T’ or a‘t’. Since the first two data words were assumed to be either “AT” or“at” (not “aT” or “At”), the information about the second characterallows the processor 28 to determine the first one (box 82). The thusdetermined first data word will now be echoed on line 44 and stored inthe buffer section of the memory unit 30 for further processing (box82). Execution continues at entry point E shown in FIG. 6B. The received(second) character is echoed and stored (box 60), and a type D interruptis enabled (box 62). This completes the autobauding steps.

The type D interrupt signals that a new data word has been received bythe UART 34 during normal operation. No autobauding steps are necessaryin this case. When a type D interrupt is determined (“NO” branches oftests 54, 72 and 78), the processor 28 reads the received data word fromthe UART 34 (box 84), echoes and stores it (box 60) and again enablesthe type D interrupt (box 62).

In box 68 shown in FIG. 6A, the UART 34 is set to the second baud ratein order to perform a suitable intermediate step, which allowssynchronization of the UART 34 with the beginning of the next (second)data word. Consider, for example, the case of a 9600 baud datatransmission. Here the UART 34 detects the mark-to-space transition atthe beginning of time interval 17 and begins the intermediate step. TheUART 34 is then expected to finish the intermediate step and issue atype B interrupt early in time interval 19, thus giving the processor 28enough time to respond to the interrupt and to reprogram the UART 34(box 74). This means that the UART 34 must perform about ten samplingoperations in at most two time intervals or 104 μs, which corresponds toa second baud rate of at least 100000 baud.

Appropriate second baud rate values for the other data transmissionspeeds can be calculated in a similar way. For transmission speeds of2400 baud and below, the UART 34 will detect a first mark-to-spacetransition after the first data bit has been transmitted (at thebeginning of time interval 17 in the case of a 2400 baud transmission).Since there will be a further mark-to-space transition at the beginningof the final data or parity bit (time interval 65 in the case of a 2400baud transmission), the second baud rate is set to a value only slightlyhigher than the determined baud rate in the present sample embodiment.This ensures that the intermediate step ends shortly before or duringthe stop bit interval of the first data word. In alternativeembodiments, the second baud rate may be set to a rather high value (forexample, 25000 baud) also for data transmission speeds of 2400 baud andbelow. Two intermediate steps are then necessary to find the correctstart bit of the next (second) transmitted data word.

In the sample embodiments described so far, the data word read by theUART 34 during the intermediate step is disregarded. For 9600 baud and4800 baud transmission speeds, this data word essentially containssamples of the final data or parity bit, which was assumed to be a spacebit. For transmission speeds of 2400 baud and below, however, the valuesof six or more of the transmitted data bits can be derived from thereceived data word. In particular, this includes the sixth data bit,which distinguishes upper and lower case characters, and the eighth dataor parity bit. This information may be used in alternative embodimentsto echo the first received character immediately and/or to determineinformation about the type of parity used during the data transmission.In some embodiments only such baud rates are considered valid for whichthis further information may be gathered.

For example, in an alternative embodiment the second baud rate might beset to 3200 baud if the first received data word has been 0×80(indicating a transmission speed of 2400 baud). After the secondmark-to-space transition has occurred at the beginning of time interval17, samples will be taken during the time intervals 19/20, 25/26, 31/32,37/38, 43/44, 49/50, 55/56, 61/62, 67/68 and 73/74. The data wordreceived during the intermediate step can then be used to determine thecase of the first transmitted data word (autobauding character) and thevalue of the parity bit according to the following table:

intermediate data word first character parity bit 0x70 a 0 0x40 A 0 0xF0a 1 0xC0 A 1

In this case it is important to take slight timing variations intoaccount. If the data was transmitted about 2% faster and an upper case‘A’ was sent, the intermediate data word would be 0×60 instead of 0×40(or 0×E0 instead of 0×C0) since the rising edge of data bit 6 wouldoccur before the sampling point in time interval 55/56. A similarshifting happens at sampling point 49/50 if a lower case ‘a’ istransmitted about 2% slower. Consequently, several intermediate datawords, which differ only in that certain bit positions are shifted, willbe accepted as representations for the expected data words given in theabove table.

Most of the sample embodiments described so far assumed the incomingdata to have either an “8 data bits, no parity” or a “7 data bits, spaceparity” format. This is required to ensure that the UART 34 will receivea mark-to-space transition to initiate the intermediate step at datatransmission speeds of 9600 baud and 4800 baud. FIG. 7 shows a furtherembodiment of the microcontroller 22, which may be used to perform theautobauding procedure for the above and various further transmissioncharacteristics.

In FIG. 7, the processor 28 comprises a digital input port 90, to whichthe RXD signal on line 46 is connected. A timer 92 is provided in themicrocontroller 22. The timer 92 may be programmed by the processor 28via a control bus 94. When the programmed time interval is over, thetimer 92 will issue a timer interrupt on a timer interrupt line 96.

The digital input port 90 and the timer 92 are used by the processor 28to sense the bit value or level of the RXD signal at predeterminedtimes. The processor 28 may thus determine the value of the sixth databit (distinguishing upper and lower case characters) and/or of theeighth data or parity bit. Consider, for example, that a datatransmission speed of 9600 baud has been detected (box 64 in FIG. 6A)during time interval 10. In order to determine the value of the paritybit (or the eighth data bit), the processor 28 sets the timer 92 toissue an interrupt after 7 further time intervals. The timer interruptwill thus occur in time interval 17, and the processor 28 may determinethe parity bit value by sensing the RXD signal at the digital input port90. Other delay times are used for other data transmission speeds.

As mentioned above, the mark-to-space transition required to initiatethe intermediate step may be missing for digital data transmissionshaving a speed of 9600 baud or 4800 baud and a characteristic of 7 databits and an even, odd or mark parity bit. By determining the value ofthe parity bit in the way described in the previous paragraph, theprocessor 28 can find out whether such a mark-to-space transition hasoccurred. If a space parity bit is detected by the processor 28, theintermediate step has been correctly initiated. If the processor 28detects a mark parity bit, there has been no mark-to-space transition,such that the intermediate step is not necessary. The processor 28 willthen reprogram the UART 34 to the determined baud rate and enable a typeC interrupt (similar to boxes 74 and 76 in FIG. 6A), thus skipping theintermediate step.

In further alternative embodiments, the information about the paritybits of the first two data words is used to determine the paritycharacteristics of the transmission, and to program the UART 34accordingly. In yet further embodiments, the timer 92 is also used todetect the upper or lower case of the first received character, suchthat it can be echoed immediately. The sampling features of themicrocontroller 22 of FIG. 7 may further be used to determine a verywide range of baud rates, which cannot be uniquely identified on thebasis of the first read data word alone.

In further alternative embodiments any status flags generated by theUART 34 may be taken into account when determining the baud rate orother transmission characteristics. The invention may also be used fordetermining other baud rates or other baud rate ratios than thosedescribed above. In particular, all baud rates given in this descritionmay be multiplied by two, four, or any other power of two. The inventionis not restricted to be applied in mobile telephones, but may instead beused in connection with all types of serial data transmissions betweendata terminal equipment (DTE) and data communications equipment (DCE).

1. A method for automatically determining the baud rate of a serial data transmission, said method comprising the steps of: a) setting a receiving device to a first baud rate, b) processing information comprising a first data word received by said receiving device to determine said baud rate of said data transmission, c) if the determined baud rate differs from said first baud rate, performing at least one intermediate step in which said receiving device is set to a further baud rate corresponding to a sampling speed which causes a further portion of the first data word in said serial data transmission to be read in by said receiving device, and, after said at least one intermediate step has been performed, setting said receiving device to said determined baud rate such that said receiving device will find the beginning of a subsequent data word in said serial data transmission and will read in said subsequent data word.
 2. The method of claim 1, wherein step b) comprises at least one of the steps of determining whether said baud rate of said data transmission is equal to said first baud rate and the step of comparing said first data word received by said receiving device with at least one predetermined value.
 3. The method of claim 1, wherein said first baud rate is the maximum baud rate of said serial data transmission.
 4. The method of claim 1, wherein said subsequent data word in said serial data transmission is the next data word after a first data word in said serial data transmission, said first data word in said serial data transmission at least partially corresponding to said first data word received by said receiving device.
 5. The method of claim 1, wherein said second baud rate depends on said determined baud rate.
 6. The method of claim 1, wherein said second baud rate is fast enough such that any remaining portion of said first data word in said serial data transmission will be read by said receiving device as a full data word.
 7. The method of claim 1, wherein, for at least one of said determined baud rates, said second baud rate is faster than said determined baud rate.
 8. The method of claim 7, wherein, for at least one of said determined baud rates, said second baud rate is less than 50% faster than said determined baud rate.
 9. The method of claim 1, wherein, for at least one of said determined baud rates, said second baud rate is fast enough such that at most two bits of said serial data transmission will be read by said receiving device as a full data word.
 10. The method of claim 1, further comprising the step of determining a bit value of said serial data transmission independently from said receiving device.
 11. The method of claim 1, further comprising the step of echoing each received data word.
 12. The method of claim 11, wherein the first echoed data word is derived from the second transmitted data word.
 13. The method of claim 1, wherein said receiving device starts to sample a signal level of said serial data transmission when said signal level meets a predetermined start condition.
 14. An apparatus for automatically determining the baud rate of a serial data transmission, said apparatus comprising a processor and a receiving device, said processor setting said receiving device to a first baud rate, said processor processing information comprising a first data word received by said receiving device to determine said baud rate of said data transmission, said processor, if the determined baud rate differs from said first baud rate, performing at least one intermediate step in which said receiving device is set to a further baud rate corresponding to a sampling speed which causes a further portion of the first data word in said serial data transmission to be read in by said receiving device, and, after said at least one intermediate step has been performed, setting said receiving device to said determined baud rate such that said receiving device will find the beginning of a subsequent data word in said serial data transmission and will read in said subsequent data word.
 15. The apparatus of claim 14, further comprising a timer programmable by said processor, and wherein said processor comprises an input port for determining a bit value of said serial data transmission independently from said receiving device at a time determined by said timer.
 16. The apparatus of claim 14, wherein said processor further determines, when processing said information comprising said first data word, whether said baud rate of said data transmission is equal to said first baud rate.
 17. The apparatus of claim 14, wherein said processor is further compares said first data word received by said receiving device with at least one predetermined value.
 18. The apparatus of claim 14, wherein said subsequent data word in said serial data transmission is the next data word after a first data word in said serial data transmission, said first data word in said serial data transmission at least partially corresponding to said first data word received by said receiving device.
 19. The apparatus of claim 14, wherein, for at least one of said determined baud rates, said second baud rate is faster than said determined baud rate.
 20. A mobile telephone comprising an apparatus for automatically determining the baud rate of a serial data transmission, said apparatus comprising a processor and a receiving device, said processor for setting said receiving device to a first baud rate, said processor processing information comprising a first data word received by said receiving device to determine said baud rate of said data transmission, said processor, if the determined baud rate differs from said first baud rate, performing at least one intermediate step in which said receiving device is set to a further baud rate corresponding to a sampling speed which causes a further portion of the first data word in said data transmission to be read in by said receiving device, and, after said at least one intermediate step had been performed, setting said receiving device to said determined baud rate such that said receiving device will find the beginning of a subsequent data word in said serial data transmission and will read in said subsequent data word. 